package com.last1mile.dao.ibatis.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.last1mile.dao.BaseSqlMapClientDao;
import com.last1mile.dao.interfaces.ServeReserveDao;
import com.last1mile.pojo.ServeReserveDO;

@Component("serveReserveDao")
public class ServeReserveDaoImpl extends BaseSqlMapClientDao implements ServeReserveDao {

    @Override
    public Integer insertServeReserve(ServeReserveDO serveReserveDo) {
        return (Integer) getSqlMapClientTemplate().insert("serveReserve.insertServeReserve", serveReserveDo);
    }
    
    @Override
    public Integer updateServeReserveBeginEndTime(ServeReserveDO serveReserveDo) {
        return (Integer) getSqlMapClientTemplate().update("serveReserve.updateServeReserveBeginEndTime", serveReserveDo);
    }
    
    @SuppressWarnings("unchecked")
    public List<ServeReserveDO> queryServeReserve(ServeReserveDO serveReserveDo){
        return (List<ServeReserveDO>) getSqlMapClientTemplate().queryForList("serveReserve.queryByReserveDo", serveReserveDo);
    }
    
    @Override
    public Integer countServeReserve(ServeReserveDO serveReserveDo) {
        return (Integer) getSqlMapClientTemplate().queryForObject("serveReserve.countByReserveDo", serveReserveDo);
    }
    
    @Override
    public ServeReserveDO queryServeReserve(Integer id) {
        return (ServeReserveDO)getSqlMapClientTemplate().queryForObject("serveReserve.queryById", id);
    }
    
    @Override
    public void updateServeStatus(ServeReserveDO serveReserveDo){
        getSqlMapClientTemplate().update("serveReserve.updateReserveStatus", serveReserveDo);
    }

    
}
